﻿<%@ Page Language="C#" MasterPageFile="~/BackEnd.master" AutoEventWireup="true" CodeFile="~/Code/State Official Search.aspx.cs"
    Inherits="State_Official_Search" %>


<asp:Content ID="Content1" ContentPlaceHolderID="cph_Main" runat="Server">
        <div style="text-align:center">Parliament Page - Reports for Your State<br />
            <br />
        </div>
        <table style="width:100%;">
            <tr>
                <td>
                    <asp:Chart ID="Chart1" runat="server" DataSourceID="chart1ds">
                        <Series>
                            <asp:Series Name="Series1" XValueMember="Type" 
                                YValueMembers="CountOfIncident_ID" YValuesPerPoint="4">
                            </asp:Series>
                        </Series>
                        <ChartAreas>
                            <asp:ChartArea Name="ChartArea1">
                            </asp:ChartArea>
                        </ChartAreas>
                    </asp:Chart>
                    <br />
                    The above chart shows the number of each type</td>
                <td>
                    <asp:Chart ID="Chart2" runat="server" DataSourceID="chart2ds">
                        <Series>
                            <asp:Series Name="Series1" XValueMember="City" 
                                YValueMembers="CountOfIncident_ID">
                            </asp:Series>
                        </Series>
                        <ChartAreas>
                            <asp:ChartArea Name="ChartArea1">
                            </asp:ChartArea>
                        </ChartAreas>
                    </asp:Chart>
                    <br />
                    The above chart shows the number in a particular city</td>
            </tr>
            <tr>
                <td>
                    <asp:AccessDataSource ID="chart1ds" runat="server" 
                        DataFile="~/App_Data/Database.accdb" 
                        SelectCommand="SELECT COUNT(Incidents.[Incident_ID]) AS CountOfIncident_ID, Incidents.[Type] FROM Incidents GROUP BY Incidents.[Type];">
                    </asp:AccessDataSource>
                </td>
                <td>
                    <asp:AccessDataSource ID="chart2ds" runat="server" 
                        DataFile="~/App_Data/Database.accdb" SelectCommand="SELECT Count(Incidents.[Incident_ID]) AS CountOfIncident_ID, Incidents.City
FROM Incidents
GROUP BY Incidents.City;
"></asp:AccessDataSource>
                </td>
            </tr>
            <tr>
                <td>
                    <asp:Chart ID="Chart3" runat="server" DataSourceID="chart3ds">
                        <Series>
                            <asp:Series ChartType="Pie" Name="Series1" XValueMember="State_Name" 
                                YValueMembers="CountOfIncident_ID" YValuesPerPoint="6">
                            </asp:Series>
                        </Series>
                        <ChartAreas>
                            <asp:ChartArea Name="ChartArea1">
                            </asp:ChartArea>
                        </ChartAreas>
                    </asp:Chart>
                    <asp:AccessDataSource ID="chart3ds" runat="server" 
                        DataFile="~/App_Data/Database.accdb" SelectCommand="SELECT Count(Incidents.[Incident_ID]) AS CountOfIncident_ID, State.State_Name
FROM State INNER JOIN Incidents ON State.State_ID = Incidents.State
GROUP BY State.State_Name;
"></asp:AccessDataSource>
                </td>
                <td>
                    <asp:Chart ID="Chart4" runat="server" DataSourceID="chart4ds">
                        <Series>
                            <asp:Series ChartType="Doughnut" Name="Series1" XValueMember="Status" 
                                YValueMembers="CountOfIncident_ID">
                            </asp:Series>
                        </Series>
                        <ChartAreas>
                            <asp:ChartArea Name="ChartArea1">
                            </asp:ChartArea>
                        </ChartAreas>
                    </asp:Chart>
                    <asp:AccessDataSource ID="chart4ds" runat="server" 
                        DataFile="~/App_Data/Database.accdb" SelectCommand="SELECT Count(Incidents.[Incident_ID]) AS CountOfIncident_ID, Incidents.Status
FROM State INNER JOIN Incidents ON State.State_ID = Incidents.State
GROUP BY Incidents.Status;
"></asp:AccessDataSource>
                </td>
            </tr>
            <tr>
                <td>
                    The above chart shows the number in each state</td>
                <td>
                    The above shows the number, depending on status</td>
            </tr>
        </table>
    <br />
    <br />
        Please find below all the Incidents for your state:<br />

                        <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                            AllowSorting="True" AutoGenerateColumns="False" 
                            DataSourceID="AccessDataSource_allIncidents" Width="100%" 
                            onselectedindexchanged="GridView1_SelectedIndexChanged" 
            CellPadding="4" ForeColor="#333333" GridLines="None">
                            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                            <Columns>
                                <asp:BoundField DataField="Incident_ID" HeaderText="Incident_ID" 
                                    InsertVisible="False" SortExpression="Incident_ID" />
                                <asp:BoundField DataField="Description" HeaderText="Description" 
                                    SortExpression="Description" />
                                <asp:BoundField DataField="Type" HeaderText="Type" 
                                    SortExpression="Type" />
                                <asp:BoundField DataField="Landmark" HeaderText="Landmark" 
                                    SortExpression="Landmark" />
                                <asp:BoundField DataField="City" HeaderText="City" 
                                    SortExpression="City" />
                                <asp:BoundField DataField="State_Name" HeaderText="State_Name" 
                                    SortExpression="State_Name" />
                                <asp:BoundField DataField="Status" HeaderText="Status" 
                                    SortExpression="Status" />
                                <asp:BoundField DataField="Date Reported" HeaderText="Date Reported" 
                                    SortExpression="Date Reported" />
                                <asp:BoundField DataField="Date Resolved" HeaderText="Date Resolved" 
                                    SortExpression="Date Resolved" />
                            </Columns>
                            <EditRowStyle BackColor="#999999" />
                            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                            <SortedAscendingCellStyle BackColor="#E9E7E2" />
                            <SortedAscendingHeaderStyle BackColor="#506C8C" />
                            <SortedDescendingCellStyle BackColor="#FFFDF8" />
                            <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                        </asp:GridView>

                        <br />

                        <br />
                        <br />


            <asp:AccessDataSource ID="AccessDataSource_allIncidents" runat="server" 
                DataFile="~/App_Data/Database.accdb" 
                
                
                SelectCommand="SELECT Incidents.Incident_ID, Incidents.User_ID, Incidents.Description, Incidents.Type, Incidents.Landmark, Incidents.City, State.State_Name, Incidents.Status, Incidents.[Date Reported], Incidents.[Date Resolved], Incidents.State FROM (Incidents INNER JOIN State ON Incidents.State = State.State_ID) WHERE (State.State_ID = ?)">
                <SelectParameters>
                    <asp:QueryStringParameter DefaultValue="1" Name="?" QueryStringField="state_ID" 
                        Type="Int32" />
                </SelectParameters>
            </asp:AccessDataSource>

</asp:Content>